/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Chat;

import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.ArrayList;
import javax.swing.JTextArea;

/**
 *
 * @author danielsl & thorerikmidtb
 *
 * This interface contains methods that are put forward from the callback server to the client, so that the client can use these methods.
 * The client will be a server so to speak, and the server the client(!)
 * Please take a look at http://java.sun.com/developer/onlineTraining/rmi/RMI.html#RMIClientSideCallbacks to understand more of this.
 */
interface Callback extends Remote{
    /**
     * This is used by the server, sending out a message containing the user name connected.
     * @param userName
     * @throws RemoteException
     */
    void connectMessage(String userName) throws RemoteException;

    /**
     * This is used by the server, sending out the message a client has typed.
     * @param message
     * @param userName
     * @throws RemoteException
     */
    void broadcastMessage(String message, String userName) throws RemoteException;

    /**
     * This is used by the server, sending a private message from a client to another client.
     * @param message
     * @param toName
     * @param fromName
     * @throws RemoteException
     */
    void whisperMessage(String message, String toName, String fromName) throws RemoteException;

    /**
     * This is used by the server, sending out a message that a client has left the server.
     * @param userName
     * @throws RemoteException
     */
    void quitMessage(String userName) throws RemoteException;

    /**
     * This is used by the server, sending out a message from the bot.
     * @param message
     * @param botName
     * @throws RemoteException
     */
    void botMessage(String message, String botName) throws RemoteException;

    /**
     * This is used by the server, sending out a message that a client has changed their name.
     * @param newName
     * @param userName
     * @throws RemoteException
     */
    void rename(String newName, String userName) throws RemoteException;


    /**
     * This is used by the server, retrieving the users score regarding the quiz.
     * @return
     * @throws RemoteException
     */
    int getQuizScore() throws RemoteException;

    /**
     * This is used by the server, setting the quiz score for a client.
     * @throws RemoteException
     */
    void setQuizScore() throws RemoteException;

    /**
     * This is used by the server, deleting the quiz score.
     * @throws RemoteException
     */
    void deleteQuizScore() throws RemoteException;

    /**
     * This is used by the server, getting the user name of the client.
     * @return
     * @throws RemoteException
     */
    String getUserName() throws RemoteException;

    /**
     * This is used by the server, setting the user name of the client.
     * @param userName
     * @throws RemoteException
     */
    void setUserName(String userName) throws RemoteException;

    /**
     * This is used by the server, showing the user who is online.
     * @param userList
     * @throws RemoteException
     */
    void getClientList(ArrayList<String> userList) throws RemoteException;

    /**
     * This is used by the server, making a new tab on the client, if he/she has not spoken to the other user private before.
     * @param fromName
     * @throws RemoteException
     */
    void receiveNewTab(String fromName) throws RemoteException;

    /**
     * This is used by the client, creating a new tab locally.
     * @param userName
     * @throws RemoteException
     */
    void createTab(String userName) throws RemoteException;

    /**
     * This is used by the server, to check if the client already has a tab open for that user.
     * @param name
     * @return
     * @throws RemoteException
     */
    boolean tabAlreadyOpened(String name) throws RemoteException;

    /**
     * This is used by the server, if an OP wants to kick a client.
     * @throws RemoteException
     */
    void getKicked() throws RemoteException;

    /**
     * This is used by the client, which sets the textarea for the private conversation.
     * @param pmArea
     * @throws RemoteException
     */
    void setPmTextArea(javax.swing.JTextArea pmArea) throws RemoteException;

    /**
     * This is used by the client, retrieving the textarea for the private conversation.
     * @param pmTabName
     * @return
     * @throws RemoteException
     */
    JTextArea getPmTextArea(String pmTabName) throws RemoteException;


    /**
     * This is used by the client, which sets the textarea for the main chat.
     * @param area
     * @throws RemoteException
     */
    void setTextArea(javax.swing.JTextArea area) throws RemoteException;



}
